Skip to content

Fix Windows background test-run signal coverage - #377

Merged
unbraind merged 17 commits into
mainfrom
fix/windows-background-test-run-signals
Jun 26, 2026
Merged

unbraind merged 17 commits into
mainfrom
fix/windows-background-test-run-signals

Conversation

@unbraind

Copy link
Copy Markdown
Owner

Summary

Fixes #376.
Tracks pm-2kkl.

This PR stabilizes the Windows nightly failure where Vitest reported Worker forks emitted error / Worker exited unexpectedly after all assertions had passed. The missing full-nightly file was tests/unit/commands/test-runs-command.spec.ts; its child fixture was sending OS-level signals to process.ppid, which can target the Vitest fork worker on Windows.

Changes:

  • Update background test-run signal coverage to call process.emit("SIGTERM"/"SIGINT") from the test process after worker progress is observed, instead of having a child fixture send OS signals to the parent process.
  • Add tests/unit/commands/test-runs-command.spec.ts to the required Windows regression CI slice so this class is caught before nightly.
  • Keep MCP dynamic upgrade routing coverage dry-run only so the broad coverage gate stays network-free and deterministic.

Validation

  • pm test pm-2kkl --run --progress (3/3 linked tests passed)
  • node scripts/run-tests.mjs coverage -> 256 files, 5132 tests, 100/100/100/100
  • pnpm typecheck
  • pnpm quality:static
  • git diff --check
  • pnpm contracts:check
  • pm health --check-only --summary --json
  • pm validate --check-resolution --check-history-drift (history drift ok; existing closed-item resolution backfill warnings remain)
  • pnpm audit --audit-level low
  • pnpm changelog:pm:check with pm-changelog 2026.6.20
  • node dist/cli.js package doctor --project --detail deep --json
  • pnpm security:scan
  • node scripts/release/sentry-telemetry-gate.mjs --json --telemetry-mode best-effort (0 critical/high Sentry issues, telemetry ok)
  • Manual temp smoke using isolated PM_PATH/PM_GLOBAL_PATH and dist/cli.js: init, create, claim, update, comment, linked test, health, validate, close, release
  • pnpm release:gates (build, typecheck/static/docs, coverage 100/100/100/100, version policy, security scan, packed npx smoke, package-first dogfood)

Notes

GitHub issue #374 / auto release remains externally blocked because the release environment does not have RELEASE_PAT configured. That is not changed by this PR.

Track: pm-2kkl

Avoid sending OS-level signals from background test child fixtures to the Vitest worker parent on Windows. The signal coverage now emits SIGTERM/SIGINT from the test process after worker progress is observed, which preserves the stop-path assertions without terminating the test runner.

Add the background test-run spec to the required Windows regression slice so GH-376 is covered before nightly. Keep the MCP dynamic upgrade routing test dry-run only so coverage remains network-free.

Validation: pm test pm-2kkl --run --progress; node scripts/run-tests.mjs coverage (100/100/100/100); pnpm release:gates; manual isolated dist/cli.js temp smoke.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @unbraind, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@unbraind

Copy link
Copy Markdown
Owner Author

@codex review
/gemini review
@gemini-code-assist review
@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@unbraind, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 37 minutes and 57 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9058e68b-d55b-4c4d-b644-118cf584b2d1

📥 Commits

Reviewing files that changed from the base of the PR and between d54a8a7 and 1b125e8.

📒 Files selected for processing (6)
  • .agents/pm/history/pm-2kkl.jsonl
  • .agents/pm/issues/pm-2kkl.toon
  • .github/workflows/ci.yml
  • .github/workflows/docs.yml
  • tests/integration/mcp-dynamic-package-actions.spec.ts
  • tests/unit/commands/test-runs-command.spec.ts
📝 Walkthrough

Walkthrough

The PR updates Windows investigation records, adds Windows regression coverage, hardens two worker-shutdown tests, and narrows the Docs workflow push trigger paths.

Changes

Windows regression investigation and hardening

Layer / File(s) Summary
Issue records and investigation log
.agents/pm/issues/pm-2kkl.toon, .agents/pm/history/pm-2kkl.jsonl
Issue status changes to in_progress with an assignee, investigation comments expand, and structured coverage, command, and test-run evidence is added.
Windows regression coverage
.github/workflows/ci.yml, tests/integration/mcp-dynamic-package-actions.spec.ts
The Windows CI regression step adds tests/unit/commands/test-runs-command.spec.ts, and the MCP upgrade action test now passes options.dryRun: true.
Signal-stop worker test
tests/unit/commands/test-runs-command.spec.ts
The worker fixture emits the pm-stop start marker, and the test waits for that marker before delivering SIGTERM and SIGINT.
Force-kill delay test
tests/unit/commands/test-runs-command.spec.ts
The default force-kill delay test removes fixture-driven SIGTERM scheduling and drives the signal from the test with finally cleanup.
Docs workflow trigger
.github/workflows/docs.yml, .agents/pm/history/pm-2kkl.jsonl
The Docs workflow push-path filter drops issue-template and workflow-file paths, and the issue history records the matching branch-protection checks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • unbraind/pm-cli#188: Modifies the same MCP dynamic package integration test area.
  • unbraind/pm-cli#289: Touches the same test-runs-command worker-stop assertions and progress metadata handling.
  • unbraind/pm-cli#325: Also changes the MCP dynamic package integration test and nearby timeout/error-path behavior.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The docs workflow trigger changes are unrelated to #376 and add scope beyond the Windows signal fix. Move the docs workflow changes to a separate PR unless they are required for #376.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing Windows background test-run signal coverage.
Description check ✅ Passed The description is directly related to the PR and matches the Windows signal-handling fix and CI coverage updates.
Linked Issues check ✅ Passed The PR addresses #376 by fixing the Windows worker-exit failure and adding regression coverage in CI.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

@unbraind Re-running a full review of this PR now, with attention to the Windows signal-handling regression, the added CI coverage slice, and the dry-run-only MCP upgrade routing coverage.

✅ Action performed

Full review finished.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request hardens the background test run lifecycle tests on Windows by replacing child process self-termination (process.kill) with process-level event emission (process.emit) from the parent test process once progress is detected in the stderr log. It also updates an MCP dynamic package integration test to use a dry-run option to avoid network requests. The reviewer identified a potential race condition in one of the modified tests due to a hardcoded 50ms timeout for emitting SIGTERM and suggested polling the stderr log for progress instead to ensure test stability on slow CI environments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses Windows Vitest worker self-termination issues in background-run signal tests by refactoring signal handling to use parent process event emission instead of child process kills, and updates the MCP dynamic package upgrade test to run as a dry-run. The review feedback highlights potential flakiness in the test-runs-command tests: first, using a hardcoded 50ms timeout to emit SIGTERM is prone to race conditions and should be replaced with a polling mechanism; second, the 500ms polling limit in the progress-ready signal helper should be increased to 10 seconds to ensure stability on slower CI environments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Track: pm-2kkl

Address Gemini review feedback by replacing the remaining fixed 50ms SIGTERM timer with stderr-progress polling and extending the signal readiness window to 10 seconds.

Validation: node scripts/run-tests.mjs test -- tests/unit/commands/test-runs-command.spec.ts; PM_RUN_TESTS_SKIP_BUILD=1 node scripts/run-tests.mjs test -- tests/unit/cli/cli-main-errors.spec.ts tests/unit/core/schema/runtime-schema-path-win32-guard.spec.ts tests/unit/helpers/scriptModule.spec.ts tests/unit/scripts/ tests/unit/packages/runtime-loaders.spec.ts tests/unit/core/telemetry/telemetry-runtime.spec.ts tests/unit/commands/test-runs-command.spec.ts; pm test pm-2kkl --run --progress.
@unbraind

Copy link
Copy Markdown
Owner Author

@codex review
/gemini review
@gemini-code-assist review
@coderabbitai full review

Re-requesting review after pushing 2c69fcf, which addresses Gemini feedback by replacing the remaining fixed signal timer with progress polling and extending readiness polling to 10 seconds.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unit/commands/test-runs-command.spec.ts`:
- Around line 795-812: The `signalWhenProgressReady` helper in
`runBackgroundTestRunWorker` is racing on slow Windows CI because it gives up
too quickly before `stderr` contains `id=pm-stop`. Increase the polling budget
in that helper (either by more attempts or a longer fixed timeout) so the marker
is observed before emitting `SIGTERM` and `SIGINT`, keeping the `stopped`
assertions deterministic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: b93bd4b6-b670-45e7-870b-884d90e9d53a

📥 Commits

Reviewing files that changed from the base of the PR and between d54a8a7 and 26abce5.

📒 Files selected for processing (5)
  • .agents/pm/history/pm-2kkl.jsonl
  • .agents/pm/issues/pm-2kkl.toon
  • .github/workflows/ci.yml
  • tests/integration/mcp-dynamic-package-actions.spec.ts
  • tests/unit/commands/test-runs-command.spec.ts

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

@unbraind Re-running a full review now, with extra attention on commit 2c69fcf0—especially the switch from the fixed signal timer to progress polling and the readiness polling extension to 10 seconds.

✅ Action performed

Full review finished.

Track: pm-2kkl

Record that PR #377 follow-up commit addressed Gemini timing feedback and that review agents were re-requested on the updated head.
@unbraind

Copy link
Copy Markdown
Owner Author

@codex review
/gemini review
@gemini-code-assist review
@coderabbitai full review

Re-requesting review after final tracker-evidence commit 579e0fc. Code changes are unchanged from 2c69fcf; this commit only records pm review-loop evidence.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

@unbraind Re-running a full review now. I’ll treat commit 579e0fc9 as tracker-evidence only and keep the review focused on confirming there’s no impact beyond the already-reviewed code state from 2c69fcf0.

✅ Action performed

Full review finished.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates issue tracking logs and hardens tests to prevent Vitest worker self-termination on Windows. Specifically, in tests/unit/commands/test-runs-command.spec.ts, the background test run lifecycle tests are modified to emit SIGTERM and SIGINT signals directly from the test process via process.emit once progress is detected, rather than relying on child processes killing the parent process. Additionally, the MCP dynamic package action integration test is updated to run as a dry run. The reviewer suggested using Promise.prototype.finally() in one of the test blocks for consistency with other similar implementations in the file.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates tracking files, configures the MCP dynamic package upgrade integration test to use a dry-run option, and refactors background test run lifecycle tests to emit process signals locally instead of calling process.kill on the parent process. The review feedback highlights that emitting global SIGTERM and SIGINT events on the process object can still trigger Vitest's own signal handlers, potentially causing unexpected worker exits. It suggests mocking process.on and process.off to capture and invoke the registered signal handlers directly, thereby isolating the signal simulation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Track: pm-2kkl

Address current Gemini review feedback by capturing the SIGTERM/SIGINT handlers registered by runBackgroundTestRunWorker and invoking those handlers directly instead of emitting process-wide signals in Vitest.

Validation: node scripts/run-tests.mjs test -- tests/unit/commands/test-runs-command.spec.ts; PM_RUN_TESTS_SKIP_BUILD=1 node scripts/run-tests.mjs test -- tests/unit/cli/cli-main-errors.spec.ts tests/unit/core/schema/runtime-schema-path-win32-guard.spec.ts tests/unit/helpers/scriptModule.spec.ts tests/unit/scripts/ tests/unit/packages/runtime-loaders.spec.ts tests/unit/core/telemetry/telemetry-runtime.spec.ts tests/unit/commands/test-runs-command.spec.ts; pnpm typecheck; pm test pm-2kkl --run --progress.
@unbraind

Copy link
Copy Markdown
Owner Author

@codex review
/gemini review
@gemini-code-assist review
@coderabbitai full review

Re-requesting review after f633255, which addresses current Gemini feedback by capturing and invoking the worker SIGTERM/SIGINT handlers directly instead of emitting process-wide signals.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

@unbraind Re-running a full review now, with extra attention on commit f633255d—especially the change from process-wide signal emission to directly capturing and invoking the worker SIGTERM/SIGINT handlers.

✅ Action performed

Full review finished.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request hardens the background test run lifecycle tests on Windows by replacing real OS signal termination with mocked process event listeners, and updates the MCP dynamic package upgrade test to run as a dry-run. The review feedback correctly identifies a potential test hang in the new polling logic if the background worker fails or exits early, and suggests introducing a flag to terminate the polling loop immediately.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Track: pm-2kkl

Address latest Gemini review feedback by adding workerFinished guards to background signal readiness polling so early worker exit cannot add a 10-second wait.

Validation: node scripts/run-tests.mjs test -- tests/unit/commands/test-runs-command.spec.ts; PM_RUN_TESTS_SKIP_BUILD=1 node scripts/run-tests.mjs test -- tests/unit/cli/cli-main-errors.spec.ts tests/unit/core/schema/runtime-schema-path-win32-guard.spec.ts tests/unit/helpers/scriptModule.spec.ts tests/unit/scripts/ tests/unit/packages/runtime-loaders.spec.ts tests/unit/core/telemetry/telemetry-runtime.spec.ts tests/unit/commands/test-runs-command.spec.ts; pnpm typecheck; pm test pm-2kkl --run --progress.
@unbraind

Copy link
Copy Markdown
Owner Author

@codex review
/gemini review
@gemini-code-assist review
@coderabbitai full review

Re-requesting review after d3b4c42, which addresses latest Gemini feedback by adding workerFinished guards so signal-readiness polling exits promptly if the worker finishes early.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

@unbraind Re-running a full review now, with extra attention on commit d3b4c423—especially the new workerFinished guards to ensure signal-readiness polling exits promptly if the worker finishes early.

✅ Action performed

Full review finished.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request resolves Windows Vitest worker self-termination issues in background-run signal tests by replacing real process signals with mocked process.on and process.off handlers to simulate SIGTERM and SIGINT events. It also updates an integration test to run the MCP upgrade action as a dry-run to keep it network-free. The reviewer points out that mocking global singletons like process.on and process.off without delegating unhandled events to their original implementations can lead to flaky tests, and provides code suggestions to delegate non-targeted events to their original implementations.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

@unbraind Re-running a full review now, with extra attention on commit 6e5d78bc—especially the extraction of the duplicated process.on/process.off signal-capture mock setup into a typed helper shared by both background signal tests.

✅ Action performed

Full review finished.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the background test run lifecycle tests in tests/unit/commands/test-runs-command.spec.ts to prevent Windows Vitest worker self-termination. Instead of having child processes send signals to the parent process via process.kill, the tests now capture and manually invoke registered SIGTERM and SIGINT handlers using a new captureProcessSignalHandlers helper. Additionally, the MCP dynamic package upgrade test is updated to use a dry-run option to keep it network-free. The review feedback correctly identifies that the immediately-invoked function expressions (IIFEs) used for signal polling should have .catch(() => {}) appended directly to them to prevent potential unhandled promise rejections.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Track pm-2kkl. Address current Gemini feedback on PR #377 by attaching catch handlers directly to the signal readiness IIFE promises and awaiting the already-handled promises in finally.\n\nVerification:\n- node scripts/run-tests.mjs test -- tests/unit/commands/test-runs-command.spec.ts\n- PM_RUN_TESTS_SKIP_BUILD=1 node scripts/run-tests.mjs test -- tests/unit/cli/cli-main-errors.spec.ts tests/unit/core/schema/runtime-schema-path-win32-guard.spec.ts tests/unit/helpers/scriptModule.spec.ts tests/unit/scripts/ tests/unit/packages/runtime-loaders.spec.ts tests/unit/core/telemetry/telemetry-runtime.spec.ts tests/unit/commands/test-runs-command.spec.ts\n- pnpm typecheck\n- git diff --check\n- PM_AUTHOR=codex-gpt5 pm test pm-2kkl --run --progress
@unbraind

Copy link
Copy Markdown
Owner Author

Review agents: new head 4197d88 addresses current Gemini feedback by attaching catch handlers directly to the signal readiness IIFE promises and awaiting the already-handled promises in finally. Please re-review the current diff.\n\n@codex review\n/gemini review\n@gemini-code-assist review\n@coderabbitai full review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

@unbraind Re-running a full review now, with extra attention on commit 4197d88b—especially the change to attach catch handlers directly to the signal-readiness IIFE promises and only await the already-handled promises during cleanup.

✅ Action performed

Full review finished.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request hardens the background test run lifecycle tests on Windows by capturing and manually triggering SIGTERM and SIGINT handlers instead of using process.kill, which was causing Vitest worker self-termination. It also updates MCP dynamic package actions to use a dry-run option. The reviewer suggests extending the signal-capturing mock to cover process.addListener and process.removeListener aliases for completeness and robustness.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Track: pm-2kkl

- add addListener/removeListener alias capture to the shared background signal test helper

- record current linked pm test evidence for the PR review follow-up

Verification:

- node scripts/run-tests.mjs test -- tests/unit/commands/test-runs-command.spec.ts

- PM_RUN_TESTS_SKIP_BUILD=1 node scripts/run-tests.mjs test -- tests/unit/cli/cli-main-errors.spec.ts tests/unit/core/schema/runtime-schema-path-win32-guard.spec.ts tests/unit/helpers/scriptModule.spec.ts tests/unit/scripts/ tests/unit/packages/runtime-loaders.spec.ts tests/unit/core/telemetry/telemetry-runtime.spec.ts tests/unit/commands/test-runs-command.spec.ts

- pnpm typecheck

- git diff --check

- PM_AUTHOR=codex-gpt5 pm test pm-2kkl --run --progress
@unbraind

Copy link
Copy Markdown
Owner Author

@codex review
/gemini review
@gemini-code-assist review
@coderabbitai full review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

@unbraind Re-running a full review of this PR now, with attention to the latest diff and the Windows signal-handling regression coverage.

✅ Action performed

Full review finished.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request hardens the background test run lifecycle tests in tests/unit/commands/test-runs-command.spec.ts to prevent Vitest worker self-termination on Windows. Instead of having child processes send signals to the parent process, the tests now capture and manually invoke the registered SIGTERM and SIGINT handlers once progress is observed in the stderr log. Additionally, the MCP dynamic package upgrade test in tests/integration/mcp-dynamic-package-actions.spec.ts has been updated to use a dry-run option to keep it network-free and stable. The issue tracking files have also been updated to reflect these changes. As there are no review comments, I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Track: pm-2kkl

- ensure the required Docs and Skills check is emitted for non-doc PRs

- keep push-to-main docs workflow path filters unchanged

Verification:

- pnpm quality:docs-skills

- pnpm quality:docs-links

- git diff --check

- PM_AUTHOR=codex-gpt5 pm test pm-2kkl --run --progress
@unbraind

Copy link
Copy Markdown
Owner Author

Review agents: new head d7ebc20 fixes the required Docs and Skills check by running docs.yml on every pull_request while preserving push path filters. Please re-review the current diff.

@codex review
/gemini review
@gemini-code-assist review
@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

@unbraind Re-running a full review now, with extra attention on commit d7ebc20e—especially the docs.yml trigger change to satisfy the required Docs and Skills check on every pull_request while preserving the existing push path filters.

✅ Action performed

Full review finished.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors background test-run signal tests in tests/unit/commands/test-runs-command.spec.ts to capture and trigger signal handlers manually, preventing Vitest worker self-termination on Windows. It also updates tests/integration/mcp-dynamic-package-actions.spec.ts to use a dry-run option for the upgrade action. Feedback on the changes suggests simplifying the offSpy implementation in the signal capture helper by consolidating redundant fallback return statements.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.agents/pm/issues/pm-2kkl.toon (1)

17-51: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Update the canonical issue synopsis to match the new scope.

Lines 17-51 now document GH-376 / Windows Node 24 investigation, expanded regression coverage, and the docs-gate unblock, but the top-level title/description/body still describe GH-348 / Node20 and the older 4-spec regression slice. Any tooling or triage flow that reads the issue metadata instead of the comment log will surface the wrong incident and verification state.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.agents/pm/issues/pm-2kkl.toon around lines 17 - 51, The issue synopsis
metadata is stale and still points to GH-348 / Node 20 plus the old 4-spec
regression scope, while the comment log now reflects GH-376 / Windows Node 24
and the docs-gate unblock. Update the canonical issue fields in this file’s
top-level title, description, and body so they match the current incident and
verification state. Keep the synopsis aligned with the latest notes and
regression coverage referenced in the issue log so tooling and triage read the
correct status.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unit/commands/test-runs-command.spec.ts`:
- Around line 855-877: The signal-stop and force-kill tests both reimplement the
same polling-and-signal dispatch logic, so extract that block into a shared
helper to prevent divergence. Move the `signalWhenProgressReady` behavior into a
reusable function (for example near the affected test cases) parameterized by
the stderr marker and the signal handler groups, and reuse it from both the
existing test around the `sigtermHandlers`/`sigintHandlers` flow and the
force-kill test so the `progressObserved`/`workerFinished` guard stays
consistent in one place.

---

Outside diff comments:
In @.agents/pm/issues/pm-2kkl.toon:
- Around line 17-51: The issue synopsis metadata is stale and still points to
GH-348 / Node 20 plus the old 4-spec regression scope, while the comment log now
reflects GH-376 / Windows Node 24 and the docs-gate unblock. Update the
canonical issue fields in this file’s top-level title, description, and body so
they match the current incident and verification state. Keep the synopsis
aligned with the latest notes and regression coverage referenced in the issue
log so tooling and triage read the correct status.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 38f622ce-fdd2-463d-807d-cb70cb07e56c

📥 Commits

Reviewing files that changed from the base of the PR and between 0c22e6e and d7ebc20.

📒 Files selected for processing (4)
  • .agents/pm/history/pm-2kkl.jsonl
  • .agents/pm/issues/pm-2kkl.toon
  • .github/workflows/docs.yml
  • tests/unit/commands/test-runs-command.spec.ts
💤 Files with no reviewable changes (1)
  • .github/workflows/docs.yml

Track: pm-2kkl

- consolidate captured process.off fallback handling

- share progress-marker signal dispatch across background signal tests

- refresh pm item synopsis for GH-348/GH-376 and docs gate follow-up

Verification:

- node scripts/run-tests.mjs test -- tests/unit/commands/test-runs-command.spec.ts

- PM_RUN_TESTS_SKIP_BUILD=1 node scripts/run-tests.mjs test -- tests/unit/cli/cli-main-errors.spec.ts tests/unit/core/schema/runtime-schema-path-win32-guard.spec.ts tests/unit/helpers/scriptModule.spec.ts tests/unit/scripts/ tests/unit/packages/runtime-loaders.spec.ts tests/unit/core/telemetry/telemetry-runtime.spec.ts tests/unit/commands/test-runs-command.spec.ts

- pnpm typecheck

- git diff --check

- PM_AUTHOR=codex-gpt5 pm test pm-2kkl --run --progress
@unbraind

Copy link
Copy Markdown
Owner Author

Review agents: new head 6c27a3a addresses current Gemini and CodeRabbit feedback by sharing the progress-marker signal dispatch helper, simplifying process.off fallback handling, and refreshing pm-2kkl synopsis metadata. Please re-review the current diff.

@codex review
/gemini review
@gemini-code-assist review
@coderabbitai full review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

@unbraind Re-running a full review now, with extra attention on commit 6c27a3a5—especially the shared progress-marker signal dispatch helper, the simplified process.off fallback handling, and the refreshed pm-2kkl synopsis metadata.

✅ Action performed

Full review finished.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request hardens the background test-run signal tests to prevent Vitest worker self-termination on Windows. It introduces captureProcessSignalHandlers and dispatchSignalsWhenProgressReady helpers in tests/unit/commands/test-runs-command.spec.ts to mock and simulate SIGTERM and SIGINT signals in-process instead of sending real signals via process.kill. Additionally, it updates tests/integration/mcp-dynamic-package-actions.spec.ts to run the MCP upgrade action as a dry run to keep it network-free. The reviewer's feedback suggests clearing the interval timer gracefully in the mock script when stopped to avoid relying on short force-kill delays, which can cause flakiness on slower CI environments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Track: pm-2kkl

- let the signal-stop fixture exit after SIGTERM instead of relying on force-kill delay

- record Gemini review follow-up evidence

Verification:

- node scripts/run-tests.mjs test -- tests/unit/commands/test-runs-command.spec.ts

- PM_RUN_TESTS_SKIP_BUILD=1 node scripts/run-tests.mjs test -- tests/unit/cli/cli-main-errors.spec.ts tests/unit/core/schema/runtime-schema-path-win32-guard.spec.ts tests/unit/helpers/scriptModule.spec.ts tests/unit/scripts/ tests/unit/packages/runtime-loaders.spec.ts tests/unit/core/telemetry/telemetry-runtime.spec.ts tests/unit/commands/test-runs-command.spec.ts

- pnpm typecheck

- git diff --check

- PM_AUTHOR=codex-gpt5 pm test pm-2kkl --run --progress
@unbraind

Copy link
Copy Markdown
Owner Author

Review agents: new head 1b125e8 addresses current Gemini feedback by clearing the signal-stop fixture interval after SIGTERM; the existing offSpy fallback is already consolidated to a single originalOff fallback. Please re-review the current diff.

@codex review
/gemini review
@gemini-code-assist review
@coderabbitai full review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

@unbraind Re-running a full review now, with extra attention on commit 1b125e81—especially the SIGTERM interval cleanup in the signal-stop fixture and confirming the existing process.off fallback remains correctly consolidated to originalOff.

✅ Action performed

Full review finished.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses the Windows nightly Vitest worker fork unexpected exit issue (GH-348/GH-376). It hardens the background test-run signal tests in test-runs-command.spec.ts by capturing and invoking SIGTERM/SIGINT handlers programmatically rather than sending real signals that could terminate the parent Vitest worker. Additionally, it updates the MCP dynamic package upgrade integration test to run as a dry-run, keeping it network-free and stable. I have no review comments or feedback to provide as the changes are well-implemented and directly address the target issues.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@unbraind
unbraind merged commit b087af6 into main Jun 26, 2026
18 checks passed
@unbraind
unbraind deleted the fix/windows-background-test-run-signals branch June 26, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nightly Validation failed: windows-latest / Node 24

1 participant